// Package sys
// @Link  https://github.com/bufanyun/hotgo
// @Copyright  Copyright (c) 2025 HotGo CLI
// @Author  Ms <133814250@qq.com>
// @License  https://github.com/bufanyun/hotgo/blob/master/LICENSE
// @AutoGenerate Version 2.15.11
package sys

import (
	"context"
	"hotgo/api/admin/walletstorebank"
	"hotgo/internal/model/input/sysin"
	"hotgo/internal/service"
)

var (
	WalletStoreBank = cWalletStoreBank{}
)

type cWalletStoreBank struct{}

// List 查看商家与银行卡列表
func (c *cWalletStoreBank) List(ctx context.Context, req *walletstorebank.ListReq) (res *walletstorebank.ListRes, err error) {
	list, totalCount, err := service.SysWalletStoreBank().List(ctx, &req.WalletStoreBankListInp)
	if err != nil {
		return
	}

	if list == nil {
		list = []*sysin.WalletStoreBankListModel{}
	}

	res = new(walletstorebank.ListRes)
	res.List = list
	res.PageRes.Pack(req, totalCount)
	return
}

// Export 导出商家与银行卡列表
func (c *cWalletStoreBank) Export(ctx context.Context, req *walletstorebank.ExportReq) (res *walletstorebank.ExportRes, err error) {
	err = service.SysWalletStoreBank().Export(ctx, &req.WalletStoreBankListInp)
	return
}

// Edit 更新商家与银行卡
func (c *cWalletStoreBank) Edit(ctx context.Context, req *walletstorebank.EditReq) (res *walletstorebank.EditRes, err error) {
	err = service.SysWalletStoreBank().Edit(ctx, &req.WalletStoreBankEditInp)
	return
}

// View 获取指定商家与银行卡信息
func (c *cWalletStoreBank) View(ctx context.Context, req *walletstorebank.ViewReq) (res *walletstorebank.ViewRes, err error) {
	data, err := service.SysWalletStoreBank().View(ctx, &req.WalletStoreBankViewInp)
	if err != nil {
		return
	}

	res = new(walletstorebank.ViewRes)
	res.WalletStoreBankViewModel = data
	return
}

// Delete 删除商家与银行卡
func (c *cWalletStoreBank) Delete(ctx context.Context, req *walletstorebank.DeleteReq) (res *walletstorebank.DeleteRes, err error) {
	err = service.SysWalletStoreBank().Delete(ctx, &req.WalletStoreBankDeleteInp)
	return
}
